<template>
	<view>
<!-- 		<basics v-if="PageCur=='basics'"></basics>
		<components v-if="PageCur=='component'"></components>
		<plugin v-if="PageCur=='plugin'"></plugin> -->
		<cover v-if="PageCur=='cover'" :dataurl='dataurl'></cover>
		<upload v-if="PageCur=='upload'"></upload>
		<textUpload v-if="PageCur=='textUpload'"></textUpload>
		<mycenter v-if="PageCur=='mycenter'"></mycenter>
		<view class="cu-bar tabbar bg-white shadow foot">
			<view class="action" @click="NavChange" data-cur="cover">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/basics' + [PageCur=='cover'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='cover'?'text-green':'text-gray'">发现</view>
			</view>
			<view class="action" @click="NavChange" data-cur="upload">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/component' + [PageCur=='upload'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='upload'?'text-green':'text-gray'">登记</view>
			</view>
			<view class="action" @click="NavChange" data-cur="textUpload">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/plugin' + [PageCur=='textUpload'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='textUpload'?'text-green':'text-gray'">上传</view>
			</view>
<!-- 			<view class="action" @click="NavChange" data-cur="basics">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/basics' + [PageCur=='basics'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='basics'?'text-green':'text-gray'">元素</view>
			</view>
			<view class="action" @click="NavChange" data-cur="component">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/component' + [PageCur == 'component'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='component'?'text-green':'text-gray'">组件</view>
			</view>
			<view class="action" @click="NavChange" data-cur="plugin">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/plugin' + [PageCur == 'plugin'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='plugin'?'text-green':'text-gray'">扩展</view>
			</view> -->
			<view class="action" @click="NavChange" data-cur="mycenter">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/mycenter' + [PageCur == 'mycenter'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='mycenter'?'text-green':'text-gray'">我的</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				PageCur: 'cover',
				dataurl: ''
			}
		},
		methods: {
			NavChange: function(e) {
				this.PageCur = e.currentTarget.dataset.cur
			}
		},
		onShow() {
			let pages = getCurrentPages();
			let currPage = pages[pages.length - 1];
			console.log(pages, currPage, '啥回事')
			this.dataurl = currPage.data.dataurl
			if (this.dataurl&&this.PageCur=='cover') {
				this.PageCur=''
				this.$nextTick(() => {
					this.PageCur = 'cover';
				})
			}else {
				return
			}
		}
	}
</script>

<style>

</style>
